package com.demo.house.filter;

import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StreamUtils;
import org.springframework.web.servlet.HandlerInterceptor;

import java.awt.image.BufferedImage;
import java.io.File;

@Component
public class MyFilter implements HandlerInterceptor {
    private final String uploadPath="D:\\img";
    public MyFilter() {
    }

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {


        if (request.getRequestURI().contains("getImg")) {

            System.out.println(request.getRequestURL());
         /*   String path = uploadPath+url;
            File file = new File(path);
            BufferedImage read = ImageIO.read(file);*/
            return false;
        }
        return true;
    }
}

